/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;


import dao.CuaHangDAO;
import dao.NhanVienDAO;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import pojo.CuaHang;
import pojo.NguoiDung;

/**
 *
 * @author ANNM
 */
public class QLNhanVien extends javax.swing.JInternalFrame {
    private DefaultComboBoxModel cbModel;
    private DefaultTableModel tablemodel;
    private NguoiDung user;
    /**
     * Creates new form QLNhanVien
     */
    public QLNhanVien() {
        initComponents();
        LayCuaHang();
        LayDSNhanVien();
        ChucVu();
    }
    public QLNhanVien(NguoiDung nguoidung) {
        initComponents();
        this.user=nguoidung;
        LayCuaHang();
        LayDSNhanVien();
        ChucVu();
        
        //JOptionPane.showMessageDialog(this, user.getPhanQuyen());
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jcbCuaHang = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jttennv = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jttaikhoan = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jtpass = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jbtThem = new javax.swing.JButton();
        jbtXoa = new javax.swing.JButton();
        jbtCapNhat = new javax.swing.JButton();
        jbtXoaTrang = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jbtDong = new javax.swing.JButton();

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(0, 51, 255));
        jLabel1.setText("QUẢN LÝ Nhân Viên");

        jcbCuaHang.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jcbCuaHang.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbCuaHangActionPerformed(evt);
            }
        });

        jLabel7.setText("Cửa hàng");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Nhập thông tin sản phẩm"));

        jLabel5.setText("Mật Khẩu");

        jLabel6.setText("Tên Nhân Viên");

        jLabel3.setText("Tài Khoản");

        jLabel2.setText("Chức Vụ");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jttaikhoan, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jtpass, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel6)))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jttennv, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
                    .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(26, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(26, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jttaikhoan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel6)
                        .addComponent(jttennv, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jtpass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel5)))
                .addGap(27, 27, 27))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Các chức năng"));

        jbtThem.setText("Thêm");
        jbtThem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtThemActionPerformed(evt);
            }
        });

        jbtXoa.setText("Xóa");
        jbtXoa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtXoaActionPerformed(evt);
            }
        });

        jbtCapNhat.setText("Cập nhật");
        jbtCapNhat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtCapNhatActionPerformed(evt);
            }
        });

        jbtXoaTrang.setText("Xóa trắng");
        jbtXoaTrang.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtXoaTrangActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jbtThem, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jbtXoaTrang)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jbtXoa, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jbtCapNhat, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jbtThem)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtXoa)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jbtCapNhat)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtXoaTrang)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Danh sách sản phẩm"));
        jPanel3.setToolTipText("");

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable1MouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jTable1);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 609, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(12, Short.MAX_VALUE))
        );

        jbtDong.setText("Đóng");
        jbtDong.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtDongActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jbtDong)
                        .addGap(58, 58, 58))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel7)
                        .addGap(18, 18, 18)
                        .addComponent(jcbCuaHang, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(213, 213, 213)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 295, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbCuaHang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(13, 13, 13)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jbtDong)
                .addContainerGap(13, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    public void LayCuaHang(){
        this.cbModel=new DefaultComboBoxModel();
        this.jcbCuaHang.setModel(cbModel);
         List<CuaHang> ds= new ArrayList<CuaHang>();
        ds=CuaHangDAO.layDanhSachCuaHang();
        if(this.user.getPhanQuyen()==2){
            int mach=this.user.getCuaHang().getMaCuaHang();
            for(int i=0;i<ds.size();i++){
                CuaHang ch=ds.get(i);
                if(ch.getMaCuaHang()==mach){
                    this.cbModel.addElement(ch);
                }
            }
        }else{
            for(int i=0;i<ds.size();i++){
                CuaHang ch=ds.get(i);
                this.cbModel.addElement(ch);

            }
        }
    }
    public void LayDSNhanVien(){
         try {     
            // int quyen=this.getPhanquyen().getPhanQuyen();
            this.tablemodel = new DefaultTableModel();
            CuaHang vt = (CuaHang) this.jcbCuaHang.getSelectedItem();
            int maCuaHang = (Integer) vt.getMaCuaHang();
            List<NguoiDung> ds=NhanVienDAO.LayDS(maCuaHang);
            //this.tablemodel.addColumn("Ma Nhân Viên");
            this.tablemodel.addColumn("Tên Nhân Viên ");
            this.tablemodel.addColumn("Chức Vụ ");
            //if(this.getPhanquyen().getPhanQuyen() ==1){
            this.tablemodel.addColumn("Tài Khoản ");
            this.tablemodel.addColumn("Mật Khẩu ");
            //this.tablemodel.addColumn("Lương");
            //}
            for(int i=0; i<ds.size(); i++){ 
                NguoiDung sp=ds.get(i); 
                Vector vt1 = new Vector();
                //vt1.add(sp.getMaNguoiDung());
                vt1.add(sp.getTenNguoiDung());
                int cv=sp.getPhanQuyen();
                String chucvu=null;
                switch (cv){
                    case 1: chucvu="Quản Lý Chuỗi Cửa Hàng";
                        break;
                    case 2: chucvu="Quản Lý Cửa Hàng";
                        break;
                    
                }
                vt1.add(chucvu);
                vt1.add(sp.getTaiKhoan());
                vt1.add(sp.getMatKhau());
                //vt1.add((sp.getLuong()));
                this.tablemodel.addRow(vt1);
            } 
            this.jTable1.setModel(tablemodel);
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
     }
     public void ChucVu(){
        this.cbModel=new DefaultComboBoxModel();
        this.jComboBox1.setModel(cbModel);
        String chucvu="Quản Lý Chuỗi Cửa Hàng";
        this.cbModel.addElement(chucvu);
        chucvu="Nhân Viên Quản Lý";
        this.cbModel.addElement(chucvu);
        
        
     } 
    private void jcbCuaHangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbCuaHangActionPerformed
        // TODO add your handling code here:
        LayDSNhanVien();
       
    }//GEN-LAST:event_jcbCuaHangActionPerformed

    private void jbtThemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtThemActionPerformed
        // TODO add your handling code here:
        int kq=NhanVienDAO.ktrauser(this.jttaikhoan.getText());
        if(kq==0){
            JOptionPane.showMessageDialog(this, "Tên Đăng nhập đã tồn tại", "Cảnh Báo", JOptionPane.WARNING_MESSAGE);
        }else{
            NguoiDung nd=new NguoiDung();
            nd.setCuaHang((CuaHang)this.jcbCuaHang.getSelectedItem());
            nd.setMatKhau(this.jtpass.getText());
            int quyen=Integer.valueOf(this.jComboBox1.getSelectedIndex());
            nd.setPhanQuyen(quyen+1);
            nd.setTaiKhoan(this.jttaikhoan.getText());
            nd.setTenNguoiDung(this.jttennv.getText());
//            nd.setTinhtrang(true);
//            nd.setLuong(Double.valueOf(this.jtluong.getText()));
            int kqua=NhanVienDAO.ThemNV(nd);
            if(kqua==0){
                JOptionPane.showMessageDialog(this,"loi");

            }else{
                JOptionPane.showMessageDialog(this,"Thành Công");
            }
        }
        LayDSNhanVien();
        
    }//GEN-LAST:event_jbtThemActionPerformed

    private void jbtXoaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtXoaActionPerformed

         NguoiDung nd=new NguoiDung();
       // nd.setMaNguoiDung(this.jtmanv.getText());
        //int manv=Integer.valueOf(this.jttaikhoan.getText());
        //nd.setMaNguoiDung(manv);
        nd.setCuaHang((CuaHang)this.jcbCuaHang.getSelectedItem());
        nd.setMatKhau(this.jtpass.getText());
        int quyen=Integer.valueOf(this.jComboBox1.getSelectedIndex());
        nd.setPhanQuyen(quyen+1);
        nd.setTaiKhoan(this.jttaikhoan.getText());
        nd.setTenNguoiDung(this.jttennv.getText());
        //nd.setLuong(Double.NaN);
        //nd.setTinhtrang(false);
        boolean kq=NhanVienDAO.xoaNV(nd);
        if(kq==false){
            JOptionPane.showMessageDialog(this,"loi");
            
        }else{
            JOptionPane.showMessageDialog(this,"Thành Công");
        }
        LayDSNhanVien();
    }//GEN-LAST:event_jbtXoaActionPerformed

    private void jbtCapNhatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtCapNhatActionPerformed
        try{
        NguoiDung nd=new NguoiDung();
        nd.setCuaHang((CuaHang)this.jcbCuaHang.getSelectedItem());
        nd.setMatKhau(this.jtpass.getText());
        int quyen=Integer.valueOf(this.jComboBox1.getSelectedIndex());
        nd.setPhanQuyen(quyen+1);
        nd.setTaiKhoan(this.jttaikhoan.getText());
        nd.setTenNguoiDung(this.jttennv.getText());
         int kq = JOptionPane.showConfirmDialog(this, "Bạn có thật sự muốn cập nhật?", "Thông báo", JOptionPane.YES_NO_OPTION);
            if (kq == JOptionPane.YES_OPTION) {
               NhanVienDAO.capNhatThongTinSanPham(nd);
            }
            JOptionPane.showMessageDialog(this, "Cập Nhật Thành Công");
            LayDSNhanVien();
        }catch (Exception ex) {
            JOptionPane.showMessageDialog(this, ex);
        }
        
    }//GEN-LAST:event_jbtCapNhatActionPerformed

    private void jbtXoaTrangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtXoaTrangActionPerformed
       
    }//GEN-LAST:event_jbtXoaTrangActionPerformed

    private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
        // TODO add your handling code here:
         int dong=this.jTable1.getSelectedRow();
        //String manv=this.jTable1.getValueAt(dong, 0).toString();
        //int masp=Integer.valueOf(ma);
        String tennv=this.jTable1.getValueAt(dong, 0).toString();
        String chucvu=this.jTable1.getValueAt(dong, 1).toString();
//        String luong=this.jTable1.getValueAt(dong, 5).toString();
      // if(this.getPhanquyen().getPhanQuyen()==1 ){
        String user=this.jTable1.getValueAt(dong, 2).toString();
        String pass=this.jTable1.getValueAt(dong, 3).toString();
        this.jtpass.setText(pass);    
        this.jttaikhoan.setText(user);
       //}
        this.jttennv.setText(tennv);
        
       
    }//GEN-LAST:event_jTable1MouseClicked

    private void jbtDongActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtDongActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_jbtDongActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JButton jbtCapNhat;
    private javax.swing.JButton jbtDong;
    private javax.swing.JButton jbtThem;
    private javax.swing.JButton jbtXoa;
    private javax.swing.JButton jbtXoaTrang;
    private javax.swing.JComboBox jcbCuaHang;
    private javax.swing.JTextField jtpass;
    private javax.swing.JTextField jttaikhoan;
    private javax.swing.JTextField jttennv;
    // End of variables declaration//GEN-END:variables
}
